package com.z3n.entities;

import java.io.Serializable;
import javax.persistence.*;


/**
 * The persistent class for the Z3N_RELATIONSHIP database table.
 * 
 */
@Entity
@Table(name="Z3N_RELATIONSHIP")
@NamedQueries({@NamedQuery(name = "getZ3nRelationshipByZ3nUser2", query = "SELECT z FROM Z3nRelationship z WHERE z.z3nUser2.userId = :z3nUser2_userId"),@NamedQuery(name = "getZ3nRelationshipByZ3nUser1", query = "SELECT z FROM Z3nRelationship z WHERE z.z3nUser1.userId = :z3nUser1_userId"),
@NamedQuery(name = "getZ3nRelationshipByRelationshipId", query = "SELECT z FROM Z3nRelationship z WHERE z.relationshipId = :relationshipId")})
public class Z3nRelationship implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="RELATIONSHIP_ID")
	private int relationshipId;

	//bi-directional many-to-one association to Z3nUser
    @ManyToOne
	@JoinColumn(name="PRINCIPAL_ID")
	private Z3nUser z3nUser1;

	//bi-directional many-to-one association to Z3nUser
    @ManyToOne
	@JoinColumn(name="EMPLOYEE_ID")
	private Z3nUser z3nUser2;

    public Z3nRelationship() {
    }

	public int getRelationshipId() {
		return this.relationshipId;
	}

	public void setRelationshipId(int relationshipId) {
		this.relationshipId = relationshipId;
	}

	public Z3nUser getZ3nUser1() {
		return this.z3nUser1;
	}

	public void setZ3nUser1(Z3nUser z3nUser1) {
		this.z3nUser1 = z3nUser1;
	}
	
	public Z3nUser getZ3nUser2() {
		return this.z3nUser2;
	}

	public void setZ3nUser2(Z3nUser z3nUser2) {
		this.z3nUser2 = z3nUser2;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + relationshipId;
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof Z3nRelationship)) {
			return false;
		}
		Z3nRelationship other = (Z3nRelationship) obj;
		if (relationshipId != other.relationshipId) {
			return false;
		}
		return true;
	}
	
}